<?php

namespace app\index\controller;

use app\index\model\Shopcart;
use think\Controller;
use think\Db;
use think\db\Query;
use think\facade\Session;
use think\Request;
use Firebase\JWT\JWT;
use Firebase\JWT\SignatureInvalidException;
class Index extends Controller
{
    public function index()
    {
        $a = Session::get("user");
        $bb = Db::name('user')->where('id',$a['id'])->select();
        $shop = Db::query('select * from httype join htgoods ON t_id = httype.id');
        $ee =Db::name('htvip_rule')->where('grade',$bb[0]['grade'])->value('booklet');
        $aa[0] =$bb;
        $aa[1] =$shop;
        $aa[2] =$ee;
        return $aa;
    }
    public function create()
    {
        return[__CLASS__,__FUNCTION__];

    }
    public function save()
    {
        $shop=new Shopcart();
        try {
            $user = $shop->joinshop();
            return ['status' => true,'error'=>'添加成功'];
        } catch (\Exception $e) {
            return ['status' => false, 'error' =>$e->getMessage()];
        }
    }

    public function read()
    {
        return '212556';
    }

    public function edit()
    {
        return  "87989898596";
    }


    public function update()
    {
      return[__CLASS__,__FUNCTION__];
    }


    public function delete()
    {
        return "52sd45sa4d";
    }
}
